//
//  LinkedList.h
//  Prism
//
//  Created by Bas du Pre on 19-05-11.
//  Copyright 2011 UU. All rights reserved.
//

#pragma once

#include <algorithm>
#include <vector>
#include <typeinfo>

#include "global.h"
#include "functions.h"

#include "PString.h"

#include "NoPObjectList.h"

namespace Prism {
    
    template <typename T>
    class List : public PObject /** \cond INTERNAL */, public NoPObjectList<T> /** \endcond */ {
    public:
        virtual String toString() {
            String str = "[List {";
            for (unsigned int i = 0; i < this->length(); i++) {
                str += objectToString(this->at(i));
                
                if (i < this->length() - 1)
                    str += ", ";
            }
            str += "}]";
            return str;
        }
        
        void append(List<T> &list) {
            for(unsigned int i = 0; i < list.length(); i++) {
                this->pushBack(list.at(i));
            }
        }
        
    };
    
}